Skip to main content

Import OpenAPI Spec

Used to import actions from an OpenAPI specification. This allows you to automatically configure API tool actions based on a standard OpenAPI/Swagger specification file, streamlining the process of integrating external APIs.

API Endpoint

PropertyValue
Request MethodPOST
Request URLhttps://api.seliseblocks.com/tools/import-openapi/{tool_id}

Request

Request Example

curl -X POST 'https://api.seliseblocks.com/tools/import-openapi/{tool_id}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"openapi": "3.0.0",
"info": {
"title": "Sample API",
"version": "1.0.0"
},
"paths": {
"/users": {
"get": {
"summary": "Get users",
"responses": {
"200": {
"description": "Successful response"
}
}
}
}
}
}'

Path Parameters

FieldTypeRequiredDescription
tool_idstringYesThe unique identifier of the API tool.

Request Headers

FieldTypeRequiredDescription
acceptstringYesAccepted response format. Use application/json
Content-Typeapplication/jsonYesData type, must be application/json.

Request Body

Request Body Schema

{
"additionalProp1": {}
}

Request Body Parameters

The request body should contain a valid OpenAPI specification object. The structure follows the OpenAPI Specification format (versions 2.0 or 3.0+).

FieldTypeRequiredDescription
openapistringNoOpenAPI specification version (e.g., "3.0.0", "3.1.0").
swaggerstringNoSwagger specification version (e.g., "2.0") for older specs.
infoobjectNoAPI metadata including title, version, and description.
pathsobjectNoAvailable API endpoints and their operations.
componentsobjectNoReusable components like schemas, parameters, and responses.
serversarrayNoAPI server URLs and configuration.
note

OpenAPI Specification Requirements

  • The request body should be a valid OpenAPI/Swagger specification
  • Supports OpenAPI 2.0 (Swagger), 3.0.x, and 3.1.x formats
  • Can be provided as a JSON object or reference
  • The specification should include at least the paths object with API endpoints
tip

After importing an OpenAPI specification, the system will:

  • Parse the OpenAPI/Swagger document
  • Extract all API endpoints and operations
  • Create corresponding actions in the API tool
  • Configure request/response schemas automatically
  • Set up authentication methods if defined in the spec
  • Validate the specification format and structure

Response

Success Response (200 OK)

Returns an object containing the import status.

{
"is_success": true,
"item_id": "tool_12345",
"detail": "OpenAPI specification imported successfully. 15 actions created.",
"error": {}
}

Response Fields

FieldTypeDescription
is_successbooleanIndicates whether the import was successful.
item_idstringThe identifier of the API tool.
detailstringSuccess or failure message with additional context.
errorobjectError details if the operation failed (empty if successful).

Error Response (422 Unprocessable Entity)

Returns validation error details when the request body is invalid.

{
"detail": [
{
"loc": [
"body",
"paths"
],
"msg": "field required",
"type": "value_error.missing"
}
]
}

Error Response Fields

FieldTypeDescription
detailarrayArray of validation error objects.
locarrayLocation of the error in the request (e.g., body field).
msgstringHuman-readable error message.
typestringError type identifier.

Error Codes

Status CodeDescriptionResponse Type
200Successful ResponseSuccess
400Bad Request - Invalid OpenAPI specificationBad Request
404Not Found - API tool does not existNot Found
422Validation Error - Invalid request parametersUnprocessable Entity